﻿using System.Xml;
using Microsoft.SharePoint.WebPartPages;


namespace SPFoundation
{
    public static class Webparts
    {
        #region Helper Methods
        public static ContentEditorWebPart GetContentEditorWP(string Title)
        {
            ContentEditorWebPart cw = new ContentEditorWebPart();
            cw.Title = "Related Links Web Part";
            cw.ChromeType = System.Web.UI.WebControls.WebParts.PartChromeType.None;
            XmlDocument xmlDoc = new XmlDocument();
            XmlElement xmlElement = xmlDoc.CreateElement("Root");
            xmlElement.InnerText = "<div style='margin-top: 10px; clear: both; padding: 0 10px 10px;'>"
            + "<hr />"
            + "<h1>Some heading</h1>"
                + "<ul>"
                    + "<li><a target='_blank' href='http://spcore.codeplex.com'>SPCore</a></li>"
                    + "<li><a target='_blank' href='http://snahta.blogspot.com'>SharePoint Sandeep</a></li>"
                + "</ul>"
            + "</div>";
            cw.Content = xmlElement;

            return cw;
        }

   
        #endregion
    }
}
